package com.sh.bean;

public class Distance_My implements Comparable<Distance_My> {
    private int index;
    // 第index条的数据的距离
    private double distance;

    public Distance_My() {
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public double getDistance() {
        return distance;
    }

    public void setDistance(double distance) {
        this.distance = distance;
    }

    public Distance_My(int index, double distance) {
        this.index = index;
        this.distance = distance;
    }

    // 比较当前distance与传进来的o的距离大小
    @Override
    public int compareTo(Distance_My o) {
        // 返回值大于0，表示当前对象大
        if (this.distance >o.distance){
            return 1;

        }else if (this.distance == o.distance){  // 相等
            return 0;
        }

        // 返回值小于0，表示当前对象小
        return -1;
    }
}
